import * as turf from "@turf/turf";

function getMask(
  geometry: turf.Geometry,
  mask = [
    [
      [-180, -90],
      [-180, 90],
      [180, 90],
      [180, -90],
      [-180, -90],
    ],
  ]
) {
  const polygon = geometry.coordinates;
  let _polygon;
  if (geometry.type === "MultiPolygon") {
    _polygon = turf.multiPolygon(polygon as turf.Position[][][], mask);
  } else {
    _polygon = turf.polygon(polygon as turf.Position[][], mask);
  }
  const _mask = turf.polygon(mask);
  // @ts-ignore
  const _masked = turf.mask(_polygon, _mask);
  return _masked;
}


export {
  getMask,

}